﻿@model CustomerDownloadableProductsModel
@using Nop.Web.Models.Customer;
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Account").Text);
}
@section left
{
    @Html.Partial("MyAccountNavigation", Model.NavigationModel, new ViewDataDictionary())
}


<div class="features_items my-account-page"><!--features_items-->
    <h2 class="title text-center">@T("Account.MyAccount") - @T("Account.DownloadableProducts")</h2>
    <div class="custom-page-box-div">
        @if (Model.Items.Count > 0)
            {
                <div id="cart_items">
    

                    <div class="table-responsive cart_info">
                        <table class="table table-condensed">
                            <thead>
                                <tr class="cart_menu">
                                    <td class="a-center order">
                                @T("DownloadableProducts.Fields.Order")
                            </td>
                            <td class="a-center date">
                                @T("DownloadableProducts.Fields.Date")
                            </td>
                            <td class="a-center product">
                                @T("DownloadableProducts.Fields.Product")
                            </td>
                            <td class="a-center download">
                                @T("DownloadableProducts.Fields.Download")
                            </td>

                
                                </tr>


                            </thead>
                            <tbody>
                                @for (int i = 0; i < Model.Items.Count; i++)
                                {
                                    var item = Model.Items[i];
                            <tr @(i % 2 == 0 ? Html.Raw(" class=\"odd\"") : Html.Raw(" class=\"even\""))>
                                <td class="a-center order">
                                    <a href="@Url.RouteUrl("OrderDetails", new { orderId = item.OrderId })">@item.OrderId</a>
                                </td>
                                <td class="a-center date">
                                    @item.CreatedOn.ToString("d")
                                </td>
                                <td class="a-center product">
                                    <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })">@item.ProductName</a>
                                    @if (!String.IsNullOrEmpty(item.ProductAttributes))
                                    {
                                        <div class="attributes">
                                            @Html.Raw(item.ProductAttributes)
                                        </div>
                                    }
                                </td>
                                <td class="a-center download">
                                    @if (item.DownloadId > 0)
                                    {
                                        <div>
                                            <a href="@Url.RouteUrl("GetDownload", new { orderItemId = item.OrderItemGuid })">@T("DownloadableProducts.Fields.Download")</a>
                                        </div>
                                    }
                                    else
                                    {
                                        <div>
                                            @T("DownloadableProducts.Fields.Download.NA")
                                        </div>
                                    }
                                    @if (item.LicenseId > 0)
                                    {
                                        <div>
                                            <a href="@Url.RouteUrl("GetLicense", new { orderItemId = item.OrderItemGuid })">@T("DownloadableProducts.Fields.DownloadLicense")</a>
                                        </div>
                                    }
                                </td>
                            </tr>
                                }
            
                            </tbody>
                        </table>
                    </div>

                </div>



                
            }
            else
            {
                <div class="alert alert-danger square-box">
                    @T("DownloadableProducts.NoItems")
                </div>
            }
    </div>
</div>


